import request from '@/utils/request'

// ==================== 回款明细 ====================

// 查询回款明细列表
export function listReturn(query) {
  return request({
    url: '/business/profit/return/list',
    method: 'get',
    params: query
  })
}

// 查询回款明细详细
export function getReturn(returnId) {
  return request({
    url: '/business/profit/return/' + returnId,
    method: 'get'
  })
}

// 新增回款明细
export function addReturn(data) {
  return request({
    url: '/business/profit/return',
    method: 'post',
    data: data
  })
}

// 修改回款明细
export function updateReturn(data) {
  return request({
    url: '/business/profit/return',
    method: 'put',
    data: data
  })
}

// 删除回款明细
export function delReturn(returnId) {
  return request({
    url: '/business/profit/return/' + returnId,
    method: 'delete'
  })
}

// 导出回款明细
export function exportReturn(query) {
  return request({
    url: '/business/profit/return/export',
    method: 'post',
    params: query
  })
}

// ==================== 售后明细 ====================

// 查询售后明细列表
export function listAftersale(query) {
  return request({
    url: '/business/profit/aftersale/list',
    method: 'get',
    params: query
  })
}

// 查询售后明细详细
export function getAftersale(aftersaleId) {
  return request({
    url: '/business/profit/aftersale/' + aftersaleId,
    method: 'get'
  })
}

// 新增售后明细
export function addAftersale(data) {
  return request({
    url: '/business/profit/aftersale',
    method: 'post',
    data: data
  })
}

// 修改售后明细
export function updateAftersale(data) {
  return request({
    url: '/business/profit/aftersale',
    method: 'put',
    data: data
  })
}

// 删除售后明细
export function delAftersale(aftersaleId) {
  return request({
    url: '/business/profit/aftersale/' + aftersaleId,
    method: 'delete'
  })
}

// 导出售后明细
export function exportAftersale(query) {
  return request({
    url: '/business/profit/aftersale/export',
    method: 'post',
    params: query
  })
}

// ==================== 利润统计 ====================

// 查询利润统计列表
export function listStatistics(query) {
  return request({
    url: '/business/profit/statistics/list',
    method: 'get',
    params: query
  })
}

// 导出利润统计
export function exportStatistics(query) {
  return request({
    url: '/business/profit/statistics/export',
    method: 'post',
    params: query
  })
}

